/* 构建路由表 */
import HomePage from '@/views/HomePage.vue';

const routes = [{
    path: '/',
    name: 'home',
    meta: { tit: '首页' },
    component: HomePage
}, {
    path: '/product/:name?/:age?',
    name: 'product',
    meta: { tit: '产品中心' },
    component: () => import('@/views/ProductPage.vue')
}, {
    path: '/personal',
    name: 'personal',
    meta: { tit: '个人中心' },
    component: () => import('@/views/PersonalPage.vue'),
    // 个人中心板块的二级路由
    children: [{
        path: '', //地址只是 '/personal'
        redirect: '/personal/order'  //默认跳转到一个最开始想展示的二级路由上
    }, {
        path: '/personal/order',
        name: 'personal_order',
        meta: { tit: '我的订单' },
        component: () => import('@/views/personal/MyOrder.vue')
    }, {
        path: 'address', // -> /personal/order
        name: 'personal_address',
        meta: { tit: '我的地址' },
        component: () => import('@/views/personal/MyAddress.vue')
    }]
}, {
    // 以上规则都没有匹配，则是跳转地址错误，此时我们不让其啥都不渲染，可以让其渲染指定的组件，也可以重定向到某个地址！！
    path: '*',
    redirect: '/'
}];
export default routes;